package com.lin.learning.questionmanagement.service.serviceimpl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lin.learning.questionmanagement.mapper.TeacherVoMapper;
import com.lin.learning.questionmanagement.service.TeacherVoService;
import com.lin.learning.questionmanagement.vo.PageVo;
import com.lin.learning.questionmanagement.vo.TeacherVo;
import com.our.learning.infrastructure.po.Teacher;
import com.our.learning.infrastructure.pojo.ResponseResult;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherVoServiceImpl extends ServiceImpl<TeacherVoMapper, TeacherVo> implements TeacherVoService {
    @Override
    public ResponseResult teacherList(Integer pageNum, Integer pageSize) {
        LambdaQueryWrapper<TeacherVo> lambdaQueryWrapper=new LambdaQueryWrapper<>();
        lambdaQueryWrapper.orderByDesc(TeacherVo::getTeacherId);
        Page<TeacherVo> page=new Page<>(pageNum,pageSize);
        page(page,lambdaQueryWrapper);
        List<TeacherVo> list=page.getRecords();
        PageVo pageVo=new PageVo(list,page.getTotal());
        return ResponseResult.okResult(pageVo);
    }
}
